package com.tzy.tzyrpcdemoconsumer;

import com.tzy.tzyrpccore.annotation.TzyRcpConsumer;
import com.tzy.tzyrpccore.conf.ConsumerConf;
import com.tzy.tzyrpcdemoapi.User;
import com.tzy.tzyrpcdemoapi.UserService;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;

@SpringBootApplication
@Import(ConsumerConf.class)
public class TzyrpcDemoConsumerApplication {

    @TzyRcpConsumer
    private UserService userService;

    public static void main(String[] args) {
        SpringApplication.run(TzyrpcDemoConsumerApplication.class, args);
    }


    @Bean
    public ApplicationRunner runServiceMethod(){
        return  (x) ->{
            User user = this.userService.findById(1120);
            System.out.println(user);
        };
    }
}
